<div th:fragment="control_condition_date">
	<script type="text/javascript">
		/** 时间控件元数据 */
		function metadata_date(params) {
			params = $.extend({}, {
				DATE : {},
				DATE_RANGE : {
					TYPE : "1",
					RANGE : 1
				}
			}, params);
			return $.extend(new metadata_base(params), this);
		}

		/** 时间控件 元数据视图 面板视图 */
		function metadata_view_date(control) {
			this.DATE = function() {
				var metadataName = "DATE";
				var view = $($("#" + metadataName).html());
				var metadata = this.control.getMetadata();
				var _this = this;
				var mValue = metadata[metadataName];
				if (mValue) {
				}
				$(this.settingPanel).append(view);
			}
			this.DATE_RANGE = function() {
				var metadataName = "DATE_RANGE";
				var view = $($("#" + metadataName).html());
				var metadata = this.control.getMetadata();
				var _this = this;
				var mValue = metadata[metadataName];
				if (mValue) {
					$(view)
							.find("select")
							.val(mValue.TYPE)
							.change(
									function() {
										var sjwd_text = [
												"<span>2000</span>年<span>01</span>月<span>01</span>日",
												"<span>2000</span>年<span>1</span>周",
												"<span>2000</span>年<span>01</span>月",
												"<span>2000</span>年" ];
										var type_value = $(this).val();
										metadata[metadataName].TYPE = type_value;
										type_value = parseInt(type_value) - 1;
										$("#startDate").html(
												sjwd_text[type_value]);
										$("#endDate").html(
												sjwd_text[type_value]);

										var type_text = $(this).find(
												"option:selected").html();
										$(view).find("span").html(type_text);

									}).popoverBind();
					$(view).find("input").val(mValue.RANGE).keyup(function() {
						metadata[metadataName].RANGE = $(this).val();
					}).popoverBind();
				}
				$(this.settingPanel).append(view);
			}
			return $.extend(new metadata_view_base(control), this);
		}

		/** 时间控件 表单视图 */
		function metadata_form_view_date(control) {
			return $.extend(new metadata_form_view_base(control), this);
		}
	</script>


	<!-- 控制面板 时间控件 标题 -->
	<script type="text/html" id="DATE">
<div class="form-setting-group">
	<label>控件ID</label><br>
	<div class="controls halfSize">
		<span>开始时间</span>
		<input readonly="readonly" value="startDate">
	</div>
	<div class="controls halfSize">
		<span>结束时间</span>
		<input readonly="readonly" value="endDate">
	</div><br>
</div>
</script>

	<!-- 控制面板  时间控件 时间维度-->
	<script type="text/html" id="DATE_RANGE">
<div class="form-setting-group">
	<div class="controls" id="weidu">
		<label>时间维度</label>
		<select data-content="选择该控件的时间维度，日、周、月、年" data-trigger="manual">
			<option value="1">日</option>
			<option value="2">周</option>
			<option value="3">月</option>
			<option value="4">年</option>
		</select>
	</div>
	<div class="controls">
		<label>开始与结束时间差</label>
		<input style="width:30px;" data-content="开始结束时间差，单位为选中的时间维度" data-trigger="manual"> <span></span>
	</div>
</div>
</script>
</div>
